<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script>
			a = 0;
			function test1(){
				//var a;
				document.write(a+"<br />");//3. undefined
				var a = 1;  //a=1;
				document.write(a+"<br />"); //4. 1
			}
			function test2(){
				document.write(a+"<br />"); //6. 0
			}
			// function test3(){
			// 	var a = 3;
			// 	document.write(a+"<br />");
			// }			
			function test3(){
				a++;	
				document.write(a+"<br />");	 //8.  1						
			}
			document.write(a+"<br />");    //1.  0
		</script>
	</head>
	<body>
		<script>
			document.write("<hr />");    //2.------------------
			test1();
			document.write("<hr />");   //5. ------------------
			test2();
			document.write("<hr />");   //7.------------------
			test3();
			document.write("<hr />"); //9.----------------
			document.write("a");   //10. a
		</script>
	</body>
</html>
